{include file='head/head' t='增加内容'}
<body>
  <div class="panel admin-panel">
    <div class="panel-head"><strong class="icon-reorder"> 内容列表</strong> <a href="" style="float:right; display:none;">添加字段</a></div>
    <div class="padding border-bottom">
      <ul class="search" style="padding-left:10px;">
        <li> <a class="button border-main icon-plus-square-o" href="good_add.html"> 添加内容</a> </li>
        <form action="" method="post" id="F">
        <li>搜索：</li>
        <li>首页全部 <input type="radio" name="butui"value="5">
            不推 <input type="radio" name="butui"  value="0">
            推荐 <input type="radio" name="butui"  value="1">
            热门
          <select name="is_hot" style="padding:5px 15px; border:1px solid #ddd;" >
          	<option value="">选择</option>
            <option value="1">是</option>
            <option value="2">否</option>
          </select>
       	 </li>
         <li>上架 <input type="checkbox" name="is_down" value="1">
             下架 <input type="checkbox" name="is_down" value="0">
             最低价格 <input type="number" name="di_prict"  value="l">
             最高价格 <input type="number" name="gao_prict" value="{$gao_prict|default=''}">
             开始时间 <input type="date" name="kaishi" value="{$kaishi|default=''}">
             结束时间 <input type="date" name="jieshi" value="{$jieshi|default=''}">
          </li>
          <li>
          	<select name="cid" style="padding:5px 15px; border:1px solid #ddd;">
                <option value="">请选择分类</option>
                {volist name='listd' id='v'}
	                <optgroup label="{$v.name}">
                    {volist name='listb' id='vv'}
                        {if $vv.parentid == $v.id}
                            <option value="{$vv.id}">&nbsp;{$vv.name}</option>
                        {/if}
                    {/volist}
                    </optgroup>
                {/volist}
          	</select>
          </li>
        <li>
          <input type="text" placeholder="商品名称搜索" name="keywords" value="{$keywords|default=''}" class="input" style="width:200px; line-height:17px;display:inline-block" />
          <a href="javascript:F.submit();" class="button border-main icon-search" > 搜索</a></li>
      </ul>
      </form>
    </div>
    <table class="table table-hover text-center">
      <tr>
        <th width="100" style="text-align:left; padding-left:20px;">ID</th>       
        <th width="15%">商品名称</th>
        <th>图片</th>
        <th>价格</th>        
        <th>分类名称</th>
        <th>上架时间</th>
        <th>推荐</th>
        <th>热门</th>
        <th>下架</th>
        <th width="310">操作</th>
      </tr>
        {foreach $zhi as $v}
      <tr>
          <td style="text-align:left; padding-left:20px;"><input type="checkbox" name="id[]" class="chk" value="<?echo $v['id']?>" />{$v['id']}</td>
          <td>
              {present name= 'keywords'}
              {:str_replace($keywords,"<font color='red'>".$keywords."</font>",$v['name'])}{else/}
              {$v.name}{/present}

          </td>
         <td width="10%"> <!--<img src="__ADMIN__/{$v['photo_x']}" alt="" width="70" height="50" />-->
              {if(!empty($v['photo_x']))}
             <img src="__ADMIN__/{$v['photo_x']}" alt="" width="70" height="50" />
             {else}
             <img src="__ADMIN__/images/X.jpg" alt="" width="70" height="50" />
             {/if}
          </td>
          <td>{$v['price_shop']}</td>
          <td>{$v['cname']}</td>
          <td>{$v['addtime']|date="Y-m-d H:i:s" }</td>

          <td>{$v['is_show'] == 1?'<img src="__ADMIN__/images/√.jpg" alt="" width="70" height="50" />':'<img src="__ADMIN__/images/X.jpg" alt="" width="70" height="50" />'}</td>
          <td>{$v['is_hot'] == 1?' <img src="__ADMIN__/images/√.jpg" alt="" width="70" height="50" />':'<img src="__ADMIN__/images/X.jpg" alt="" width="70" height="50" />'}</td>
          <td>{$v['is_down']== 1?' <img src="__ADMIN__/images/√.jpg" alt="" width="70" height="50" />':'<img src="__ADMIN__/images/X.jpg" alt="" width="70" height="50" />'}</td>
          <td><div class="button-group"> <a class="button border-main" href="{:url('admin/Spgl/goodAdd')}"><span class="icon-edit"></span> 修改</a> <a class="button border-red" href="javascript:void(0)" onclick="return del(1,1,1)"><span class="icon-trash-o"></span> 删除</a> </div></td>
        </tr>
        {/foreach}

        <td style="text-align:left; padding:19px 0;padding-left:20px;"><input type="checkbox" id="checkall"/>
          全选 </td>
        <td colspan="9" style="text-align:left;padding-left:20px;"><a href="javascript:void(0)" class="button border-red icon-trash-o" style="padding:5px 15px;" onclick="DelSelect()"> 删除</a> <a href="javascript:void(0)" style="padding:5px 15px; margin:0 10px;" class="button border-blue icon-edit" onclick="sorts()"> 排序</a> 操作：
          <select name="ishome" style="padding:5px 15px; border:1px solid #ddd;" onchange="changeishome(this)">
            <option value="">首页</option>
            <option value="1">是</option>
            <option value="0">否</option>
          </select>
          <select name="isvouch" style="padding:5px 15px; border:1px solid #ddd;" onchange="changeisvouch(this)">
            <option value="">推荐</option>
            <option value="1">是</option>
            <option value="0">否</option>
          </select>
          <select name="istop" style="padding:5px 15px; border:1px solid #ddd;" onchange="changeistop(this)">
            <option value="">下架</option>
            <option value="1">是</option>
            <option value="0">否</option>
          </select>
        </td>
      </tr>
      <tr>
        <td colspan="9"><div class="pagelist"> <a href="">上一页</a> <span class="current">1</span><a href="">2</a><a href="">3</a><a href="">下一页</a><a href="">尾页</a> </div></td>
      </tr>
    </table>
  </div>
<script type="text/javascript">

//搜索
function changesearch(){	
		
}

//单个删除
function del(id,mid,iscid){
	if(confirm("您确定要删除吗?")){
		
	}
}

//全选
$("#checkall").click(function(){ 
  $("input[name='id[]']").each(function(){
	  if (this.checked) {
		  this.checked = false;
	  }
	  else {
		  this.checked = true;
	  }
  });
})

//批量删除
function DelSelect(){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){
		var t=confirm("您确认要删除选中的内容吗？");
		if (t==false) return false;		
		$("#listform").submit();		
	}
	else{
		alert("请选择您要删除的内容!");
		return false;
	}
}

//批量排序
function sorts(){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){	
		
		$("#listform").submit();		
	}
	else{
		alert("请选择要操作的内容!");
		return false;
	}
}


//批量首页显示
function changeishome(o){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){
		
		$("#listform").submit();	
	}
	else{
		alert("请选择要操作的内容!");		
	
		return false;
	}
}

//批量推荐
function changeisvouch(o){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){
		
		
		$("#listform").submit();	
	}
	else{
		alert("请选择要操作的内容!");	
		
		return false;
	}
}

//批量置顶
function changeistop(o){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){		
		
		$("#listform").submit();	
	}
	else{
		alert("请选择要操作的内容!");		
	
		return false;
	}
}


//批量移动
function changecate(o){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){		
		
		$("#listform").submit();		
	}
	else{
		alert("请选择要操作的内容!");
		
		return false;
	}
}

//批量复制
function changecopy(o){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){	
		var i = 0;
	    $("input[name='id[]']").each(function(){
	  		if (this.checked==true) {
				i++;
			}		
	    });
		if(i>1){ 
	    	alert("只能选择一条信息!");
			$(o).find("option:first").prop("selected","selected");
		}else{
		
			$("#listform").submit();		
		}	
	}
	else{
		alert("请选择要复制的内容!");
		$(o).find("option:first").prop("selected","selected");
		return false;
	}
}

</script>
</body>
</html>